<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .col-label {
            }

            .col-input {
            }
        </style>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                }
            }

            function doPopupWindow(obj) {
                var pkid = obj.parentNode.parentNode.parentNode.childNodes[0].childNodes[0].innerHTML;
                popupwindow = window.open("custAddInfoDeltDetl.xhtml?action=editinfo&amp;pkid=" + pkid, "popupwindow", "height=600,width=800,left=200,top=100,toolbar=no,menubar=no,scrollbars=yes,location=no");
                popupwindow.focus;
            }
        </script>
    </ui:define>

    <ui:define name="content">
        <div style="margin:5px;">
            <p:growl id="msgs" showDetail="false"/>
                    <h:form id="form">
                        <p:panel header="【客户信息】查询条件">
                            <h:panelGrid columns="2" cellspacing="5" columnClasses="col-80,col-20">
                                <h:panelGrid columns="4" cellspacing="5"
                                             columnClasses="col-95,col-5,col-95,col-5">
                                    <h:outputLabel value="客户号:" for="custno"/>
                                    <h:inputText id="custno" size="30"
                                                 value="#{customerAction.custBase.custno}"/>
                                     <h:outputLabel value="客户名称:" for="custname"/>
                                    <h:inputText id="custname" size="30"
                                                 value="#{customerAction.custBase.custname}"/>
                                </h:panelGrid>

                                <h:panelGrid columns="2">
                                    <p:commandButton id="qrybtn" style="width:80px;" value="查询"
                                                     action="#{customerAction.onQuery}"
                                                     update="pdt,msgs">
                                    </p:commandButton>
                                    <p:commandButton ajax="false" id="btnprt" value="重置"
                                                     type="reset"
                                                     style="width:80px;"/>
                                </h:panelGrid>
                            </h:panelGrid>
                        </p:panel>

                        <p:ajaxStatus style="height:18px;text-align:center">
                            <f:facet name="start">
                                <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value=""/>
                            </f:facet>
                        </p:ajaxStatus>
                        <p:dataTable id="pdt" style="width:100%;"
                                     value="#{customerAction.customerList}" var="record"
                                     selection="#{customerAction.selectedRecord}" selectionMode="single"
                                     rowKey="#{record.basePkid}"
                                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                     paginator="true" rows="15" paginatorPosition="bottom"
                                     rowsPerPageTemplate="100,50,30,15,5"
                                     emptyMessage="数据记录为空...">
                            <f:facet name="header">
                                客户信息表
                            </f:facet>
                            <p:column style="display:none;" headerText="pkid">
                                <h:outputText value="#{record.basePkid}"/>
                            </p:column>
                            <p:column headerText="客户号" style="text-align:center" sortBy="#{record.custno}">
                                <h:outputText value="#{record.custno}"/>
                            </p:column>
                            <p:column headerText="客户名称" style="text-align:left">
                                 <h:outputText value="#{record.custname}"/>
                            </p:column>
                            <p:column headerText="经理姓名" style="text-align:left">
                                <h:outputText value="#{record.managerName}"/>
                            </p:column>
                            <p:column headerText="联系电话" style="text-align:left">
                                <h:outputText value="#{record.managerPhone1}"/>
                            </p:column>

                            <p:column headerText="操作" style="width:50px;text-align:center">
                                <p:commandLink style="color:blue;" value="删除" update="popupwindow"
                                               onclick="doPopupWindow(this);">
                                </p:commandLink>
                            </p:column>
                        </p:dataTable>
                    </h:form>
        </div>
    </ui:define>

</ui:composition>